// import './assets/js/rem';
// rem自适应 适配
// import 'amfe-flexible'
//引入ElementUI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import "./static/css/main.css";
import "./assets/css/index.scss"
import "./assets/css/font/customizeFont.css"
import {settoken} from './axios/login/login'
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
import Vue from 'vue'
import App from './App'
import router from './router'


Vue.config.productionTip = false

//引入momentjs
import moment from 'moment'

Vue.prototype.$moment = moment
Vue.use(VueVideoPlayer, /* {
    options: global default options,
    events: global videojs events
} */)
// 引入echarts
import * as echarts from 'echarts';

Vue.prototype.$echarts = echarts

Vue.use(ElementUI)

/* eslint-disable no-new */
// new Vue({
//   el: '#app',
//   router,
//   components: { App },
//   template: '<App/>'
// })
let dominUrl = window.localStorage.getItem('dominUrl');

Vue.prototype.$gToken = function () {
    if (window.location.href.indexOf('token') !== -1) {
        let Url = window.location.href
        let arrAy = Url.split('?')
        let splt = arrAy[1].split('=')
        // let token = splt[1].replace('%20', ' ')
        let token = splt[1]
        window.localStorage.setItem('token', 'Bearer ' + token)
        settoken('Bearer ' + token)
            .then(res => {
                // console.log(res);
                // alert(JSON.parse(window.localStorage.getItem('User')))
                // console.log(token);
            }, err => {
                window.location.href = dominUrl + '/#/login?redirectUrl=' + dominUrl + '/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm';
                // window.location.href = "http://114.67.250.8/#/login" + "?redirectUrl=http://114.67.250.8/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm"
                // window.location.href = "http://116.131.8.40:8888/#/login" + "?redirectUrl=http://116.131.8.40:8888/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm"
            })
    } else {
        // window.location.reload()
        window.location.href = dominUrl + '/#/login?redirectUrl=' + dominUrl + '/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm';
        // window.location.href = "http://114.67.250.8/#/login" + "?redirectUrl=http://114.67.250.8/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm"
        // window.location.href = "http://116.131.8.40:8888/#/login" + "?redirectUrl=http://116.131.8.40:8888/garden_V2/#/visitor&appCode=GARDENSV2ITeFcKAH2XwjUAtyrm"
    }
}
new Vue({
    router,
    render: h => h(App)
}).$mount('#app')
